package com.ytzl.itrip.service.impl;
import com.ytzl.itrip.dao.ItripHotelFeatureMapper;
import com.ytzl.itrip.service.ItripHotelFeatureService;
import com.ytzl.itrip.pojo.ItripHotelFeature;
import com.ytzl.itrip.common.EmptyUtils;
import com.ytzl.itrip.common.Constants;
import com.ytzl.itrip.common.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class ItripHotelFeatureServiceImpl implements ItripHotelFeatureService {

@Resource
private ItripHotelFeatureMapper itripHotelFeatureMapper;

public ItripHotelFeature getItripHotelFeatureById(Long id)throws Exception{
return itripHotelFeatureMapper.getItripHotelFeatureById(id);
}
public Integer removeItripHotelFeatureById(Long id)throws Exception{
return itripHotelFeatureMapper.removeItripHotelFeatureById(id);
}

public List<ItripHotelFeature>    getItripHotelFeatureListByMap(Map
<String,Object> param)throws Exception{
List<ItripHotelFeature> list = itripHotelFeatureMapper.getItripHotelFeatureListByMap(param);
return list;
}

public Integer getItripHotelFeatureCountByMap(Map
<String,Object> param)throws Exception{
return itripHotelFeatureMapper.getItripHotelFeatureCountByMap(param);
}

public Integer saveItripHotelFeature(ItripHotelFeature itripHotelFeature)throws Exception{
itripHotelFeature.setCreationDate(new Date());
return itripHotelFeatureMapper.saveItripHotelFeature(itripHotelFeature);
}

public Integer modifyItripHotelFeature(ItripHotelFeature itripHotelFeature)throws Exception{
itripHotelFeature.setModifyDate(new Date());
return itripHotelFeatureMapper.modifyItripHotelFeature(itripHotelFeature);
}
public Integer removeItripHotelFeatureByIds(Long[] ids)throws Exception{
return itripHotelFeatureMapper.removeItripHotelFeatureByIds(ids);
}

public Page<ItripHotelFeature> queryItripHotelFeaturePageByMap(Map<String,Object> param,Integer pageNo,Integer pageSize)throws Exception{
Integer total = itripHotelFeatureMapper.getItripHotelFeatureCountByMap(param);
pageNo = EmptyUtils.isEmpty(pageNo) ? Constants.DEFAULT_PAGE_NO : pageNo;
pageSize = EmptyUtils.isEmpty(pageSize) ? Constants.DEFAULT_PAGE_SIZE : pageSize;
Page page = new Page(pageNo, pageSize, total);
param.put("beginPos", page.getBeginPos());
param.put("pageSize", page.getPageSize());
List<ItripHotelFeature> itripHotelFeatureList = itripHotelFeatureMapper.getItripHotelFeatureListByMap(param);
page.setRows(itripHotelFeatureList);
return page;
}

}
